import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2022-10-14
 * Time: 16:18
 */
//倒置字符串
public class Main {
    public static void reverse(char []array,int start,int end){
        while(start<end){
            char tmp=array[start];
            array[start]=array[end];
            array[end]=tmp;
            start++;
            end--;
        }

    }
    public static void main(String[] args) {
        Scanner  scanner= new Scanner(System.in);
        String s=scanner.nextLine();
        char []ch=s.toCharArray();//字符串转数组
        int len=ch.length;
        //实现整体倒置，自己写一个
        reverse(ch,0,len-1);
        //遍历数组
        int i=0;
        while(i<len){
            int j=i;
            while(j<len && ch [j]!=' '){
                    j++;
            }
            if(j<len){
                reverse(ch,i,j-1);
                i=j+1;
            }else{
                reverse(ch,i,j-1);
                i=j;
            }
        }
        String str=new String(ch);//数组转字符串
        System.out.println(str);



    }
}
